package com.retail.setting.service.impl;


import com.retail.setting.entity.vo.RetailFxLevelVo;
import com.retail.core.entity.ParamReq;
import com.retail.setting.entity.request.RetailFxLevelRequest;
import com.retail.setting.mapper.RetailFxLevelMapper;
import com.retail.setting.service.RetailFxLevelService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
* 分销等级设置 Service impl
* @author Administrator
*/
@Service
public class RetailFxLevelServiceImpl implements RetailFxLevelService {

   @Resource
   private RetailFxLevelMapper retailFxLevelMapper;

   @Override
   public RetailFxLevelVo getModel(Long id) {
      return  retailFxLevelMapper.getModel(id);
   }

   @Transactional
   @Override
   public Long save(RetailFxLevelRequest retailFxLevelRequest) {
      retailFxLevelMapper.save(retailFxLevelRequest);
      return retailFxLevelRequest.getId();
   }

   @Transactional
   @Override
   public Long update(RetailFxLevelRequest retailFxLevelRequest) {
      retailFxLevelMapper.update(retailFxLevelRequest);
      return retailFxLevelRequest.getId();
   }

   @Override
   public List<RetailFxLevelVo> listPage(ParamReq<RetailFxLevelRequest> params) {
      params.setStartIndex((params.getCurrent() -1 ) * params.getSize());
      return retailFxLevelMapper.listPage(params);
   }

   @Override
   public Integer countPage(ParamReq<RetailFxLevelRequest> params) {
       return retailFxLevelMapper.countPage(params);
   }

   @Override
   public Integer updateDelFlagById(Long id, Integer delFlag) {
       return retailFxLevelMapper.updateDelFlagById(id, delFlag);
   }

    @Override
    public List<RetailFxLevelVo> getAllModel() {
      return retailFxLevelMapper.getAllModel();
    }
}
